import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store/index";
import { Calendar, Toast, Dialog } from 'vant';
import "@/styles/reset.css";
import "@/styles/index.less";
import "@/apis/core/interceptor.js";
import Btn from "@/components/Button.vue";
import Table from "@/components/Table.vue";
import Navbar from "@/components/NavBar.vue";
import CountDown from "@/components/CountDown.vue";
import 'virtual:svg-icons-register';

const app = createApp(App);
app.use(router);
app.use(store);
app.use(Calendar);
app.use(Toast);
app.use(Dialog);

app.component("Navbar", Navbar);
app.component("Button", Btn);
app.component("Table", Table);
app.component("CountDown", CountDown);

app.config.globalProperties.$toast = Toast;
app.config.globalProperties.$dialog = Dialog;
app.config.globalProperties.isLogin = () => $storage.get("cookiekey");
app.config.globalProperties.$filters = {
  byThousands(value) {
    return formatBalance(value);
  },
};
window.$vm = app.config.globalProperties;

app.mount("#app");
